package com.dmall.leetcode;

import java.util.Arrays;

public class Leetcode1 {
    public int[] twoSum(int[] nums, int target) {
        int[] index = new int[2];
        Arrays.fill(index, -1);
        for (int i = 0; i < nums.length; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (target == nums[i] + nums[j]) {
                    index[0] = i;
                    index[1] = j;
                    return index;
                }
            }
        }
        return index;
    }

    public static void main(String[] args) {
        // int[] nums = {0, 4, 3, 0};
        int[] nums = {-1, -2, -3, -4, -5};
        Leetcode1 leetcode1 = new Leetcode1();
        Arrays.stream(leetcode1.twoSum(nums, -8)).forEach(System.out::println);
    }
}
